<?php
use yii\helpers\Url;

?>

    <link href="/backend/css/new-business.css" rel="stylesheet">
    <!-- 引入 echarts.js -->

    <div class="row">
        <div class=" lh30">
            <?= $this->render('../_nav'); ?>
        </div>
    </div>

    <section class="container" style="padding-top:10px;">

        <div id="myTabContent" class="tab-content">
            <!--  business noe     -->
            <div class="tab-row">
                <?= $this->render('../_financial_data'); ?>
                <div class="tab-row-tow" id="tab-row-tow">
                    <!--   营业收入       -->
                    <a href="<?= Url::toRoute(['financial/cashier', 'action' => 'saleamount', 'searchTime' => Yii::$app->request->get()['searchTime'], 'start_time' => Yii::$app->request->get()['start_time'],  'end_time' => Yii::$app->request->get()['end_time']]) ?>">
                        <div class="ml0 tab-row-box  fl">
                            <div class="tab-box-icon h ">
                                <img src="/backend/img/financial/income_ico.png" class="d-none">
                                <img src="/backend/img/financial/income_ico1.png" class="">
                            </div>
                            <div class="tab-box-text ">
                                <span style="font-size: 16px;">营业收入<em style="color: #c3a279">￥<?php echo $other_common['consumeList'][0]['consume_amount'] ? $other_common['consumeList'][0]['consume_amount'] : '0.00'; ?>元</em></span>
                                <span style="font-size: 13px;">现金:<em style="color: #fe7b9d">￥<?php echo $other_common['consumeList'][0]['cash_pay'] ? $other_common['consumeList'][0]['cash_pay'] : '0.00'; ?>元</em></span>
                                <span style="font-size: 13px;">刷卡:<em style="color: #fe7b9d">￥<?php echo $other_common['consumeList'][0]['unionpay'] ? $other_common['consumeList'][0]['unionpay'] : '0.00'; ?>元</em></span>
                            </div>
                        </div>
                    </a>
                    <!--   到店会员       -->
                    <a href="<?= Url::toRoute(['financial/cashier', 'action' => 'one', 'searchTime' => Yii::$app->request->get()['searchTime'], 'start_time' => Yii::$app->request->get()['start_time'],  'end_time' => Yii::$app->request->get()['end_time']]) ?>">
                        <div class="tab-row-box current fl">
                            <div class="tab-box-icon current ">
                                <img src="/backend/img/financial/store_ico.png" class="">
                                <img src="/backend/img/financial/store_ico1.png" class=" d-none">
                            </div>
                            <div class="tab-box-text current ">
                                <span style="font-size: 16px;">到店会员：<em style="color: #c3a279"><?php echo $other_common['come_member']; ?></em></span>
                                <span style="font-size: 13px;">新增会员：<em style="color: #c3a279"><?php echo $other_common['bus_members'][0]['member_id']; ?></em> </span>
                            </div>
                        </div>
                    </a>
                    <!--   消化金额       -->
                    <a href="<?= Url::toRoute(['financial/cashier', 'action' => 'two', 'searchTime' => Yii::$app->request->get()['searchTime'], 'start_time' => Yii::$app->request->get()['start_time'],  'end_time' => Yii::$app->request->get()['end_time']]) ?>">
                        <div class="tab-row-box  fl">
                            <div class="tab-box-icon z">
                                <img src="/backend/img/financial/consume_ico.png" class="d-none">
                                <img src="/backend/img/financial/consume_ico1.png" class="">
                            </div>
                            <div class="tab-box-text ">
                                <span style="font-size: 16px;">消耗金额</span>
                                <span
                                    style="font-size: 13px;"><em style="color: #c3a279">￥<?php echo $other_common['bus_service_extends'][0]['consume_amount'] ? $other_common['bus_service_extends'][0]['consume_amount']: '0.00'; ?>
                                    元</em></span>
                            </div>
                        </div>
                    </a>
                    <!--   手工提成       -->
                    <a href="<?= Url::toRoute(['financial/cashier', 'action' => 'three', 'searchTime' => Yii::$app->request->get()['searchTime'], 'start_time' => Yii::$app->request->get()['start_time'],  'end_time' => Yii::$app->request->get()['end_time']]) ?>">
                        <div class="tab-row-box  fl">
                            <div class="tab-box-icon l ">
                                <img src="/backend/img/financial/manual_ico.png" class="d-none">
                                <img src="/backend/img/financial/manual_ico1.png" class="">
                            </div>
                            <div class="tab-box-text ">
                                <span style="font-size: 16px;">手工提成</span>
                                <span><em style="color: #c3a279">￥<?php echo $other_common['sum_handwork_reward'][0]['handwork_reward'] ? $other_common['sum_handwork_reward'][0]['handwork_reward'] : '0.00'; ?>元</em></span>
                            </div>
                        </div>
                    </a>
                </div>
            </div>
            <!--  business tow      -->
            <div class="clearfix"></div>
            <div class="tab-list">
                <!--  business-list one   -->
                <div class="tab-list-box">
                    <div class="title">
                        <span>到店会员</span>
                    </div>
                    <div class="list-box fl">
                        <dl class="table-tr table-title-ft">
                            <dt>类别</dt>
                            <dd>业绩</dd>
                            <dd>占比</dd>
                        </dl>

                        <dl class="table-tr table-mes-ft">
                            <dt>老会员</dt>
                            <dd>￥<?php echo $old_consumeList[0]['consume_amount'] ? $old_consumeList[0]['consume_amount'] : '0.00'; ?></dd>
                            <dd><?php echo round($old_consumeList[0]['consume_amount'] / ($old_consumeList[0]['consume_amount'] + $consumeList[0]['consume_amount']) * 100, 2); ?>
                                %
                            </dd>
                        </dl>

                        <dl class="table-tr table-mes-ft">
                            <dt>新会员</dt>
                            <dd>￥<?php echo $consumeList[0]['consume_amount'] ? $consumeList[0]['consume_amount'] : '0.00'; ?></dd>
                            <dd><?php echo round($consumeList[0]['consume_amount'] / ($old_consumeList[0]['consume_amount'] + $consumeList[0]['consume_amount']) * 100, 2); ?>
                                %
                            </dd>
                        </dl>
                    </div>

                    <div class="list-box fr b-none">
                        <div id="main" style="width:100%;height:260px;"></div>
                        <script type="text/javascript">
                            // 基于准备好的dom，初始化echarts实例
                            var myChart = echarts.init(document.getElementById('main'));
                            var consumeList = <?php echo $consumeList[0]['consume_amount']?$consumeList[0]['consume_amount']:0;?>,
                                old_consumeList = <?php echo $old_consumeList[0]['consume_amount']?$old_consumeList[0]['consume_amount']:0;?>,
                            // 指定图表的配置项和数据
                            option = {
                                title: {},
                                tooltip: {
                                    trigger: 'item',
                                    formatter: "{d}%"
                                },
                                legend: {},
                                textStyle:{
                                    color:'#6f6f6f',
                                },
                                series: [
                                    {
                                        name: '访问来源',
                                        type: 'pie',
                                        radius : ['40%', '65%'],
                                        center: ['50%', '50%'],
                                        data: [
                                            {
                                                value:consumeList,
                                                name: '新会员(￥'+consumeList.toFixed(2)+')',
                                                itemStyle: {
                                                    normal: {
                                                        color: '#ff6ca0'
                                                    }
                                                },
                                            },
                                            {
                                                value:old_consumeList,
                                                name: '老会员(￥'+old_consumeList.toFixed(2)+')',
                                                itemStyle: {
                                                    normal: {
                                                        color: '#ffbe7c'
                                                    }
                                                },
                                            },
                                        ],
                                        itemStyle: {
                                            emphasis: {
                                                shadowBlur: 10,
                                                shadowOffsetX: 0,
                                                shadowColor: 'rgba(0, 0, 0, 0.5)'
                                            }
                                        }
                                    }
                                ]
                            };

                            // 使用刚指定的配置项和数据显示图表。
                            myChart.setOption(option);
                        </script>
                    </div>
                </div>

                <div class="clearfix"></div>

            </div>
        </div>
    </section>

<?php $this->registerJsFile("@web/libs/echarts/echarts.js", ['position' => $this::POS_HEAD]); ?>